(function(){var k,c,l;try{var u=window.$MicrosoftMaps8,n=u.Internal,ai=n._WorkDispatcher,wt=u.Anchor,bt=u.BasicTemplate,vi=n._BinaryObject,yi=u.BitmapImageTemplate,kt=u.ChildVectorImageTemplate,dt=n._CurveKey,ft=n._Curve,s=n._Color,pi=n._CurveVector4,et=n._CurveColor,v=n._CurveColorHelper,ot=n.CustomMapStyleManager,g=n._DiscreteRangeCollectionSpline,t=n._Debug,gt=n._Gimme,f=u.GlobalConfig,i=n._Helper,st=n._HslaTransformCurve,y=n._JSEvent,nt=f.features.labels,ni=n._LatLonCrs,wi=u.LocationRect,a=n._LruCache,ti=u.Matrix2D,ii=n._MapAuthentication,ri=u.Location,bi=u.MapMath,e=u.MercatorCubeCrs,ki=n._MercatorTileUtility,h=n._Network,tt=n._Observable,di=n._ObservableObject,ui=u.Point,gi=n.PyramidTileSpatialIndex,nr=u.Rectangle,fi=n.SheetSpatialIndex,it=n.StaticPromise,ei=u.SimplePointPrimitive,ht=n._TransformCurve,ct=n._Url,r=u.VectorImageTemplate,p=n._VectorMath,o=f.features.xsr,b=u.ZoomLevel,lt=this&&this.__spreadArray||function(n,t,i){if(i||arguments.length===2)for(var r=0,f=t.length,u;r-1;this._id=this._jsonsoSuffix="basemap";this._requests={};this.invalidated=new y;n.mapTypeChangeStarted.add(function(){return o._updateCstl()});this._updateCstl()}return n.prototype.getLayerDataSource=function(n){return new yt(n,this,this.spatialIndex)},n.prototype.cancelPrimitivesRequest=function(n,t){var i=this._getDispatchKey(n,null,t||"",this._id);h.abortRequest(this._requests[i])},n.prototype.cancelPrimitivesRequestInternal=function(n,t,i){var r=this._getDispatchKey(n,t,i||"",this._id);h.abortRequest(this._requests[r])},n.prototype.getPrimitives=function(n,t,i,r){this.getPrimitivesInternal(n,null,t,i,r)},n.prototype.shouldFetchPrimitives=function(){return!0},n.prototype.getPrimitivesInternal=function(t,r,u,f,e){var c=this._getDispatchKey(t,r,f||"",this._id),s,h,l,v;if(e=Math.round(e),ethis._maxZoom||!this.shouldFetchPrimitives())this._completeRequest(u,{primitives:[]},c);else{var a=t.quadKey,y=this.getFilterKey(),p=this._cstl,o=this._urlFormat.replace(/{quadkey}/ig,a).replace(/{subdomain}/ig,i._getTileSubDomain(a)).replace(/{filter}/ig,y).replace(/{cstl}/ig,p);o.startsWith("data:")||(s=ct.fromString(o),typeof FunctionalTestHooks!="undefined"&&(h=s.queryStringParameters&&s.queryStringParameters.ourl,h&&(h=ct.fromString(atob(h)).toString(!0,!0),s.queryStringParameters.ourl=btoa(h))),o=s.toString(!0,!0));l=n._responsesCacheV2.getItem(o);l?(v=this._getVectorDataResponse(r,l),this._completeRequest(u,this._filterResponse(v),c)):this._downloadGrid(t,c,r,o,u)}},n.prototype._filterResponse=function(n){return n},n.prototype.applyFilter=function(n){this._filter=n;this.invalidated.invoke()},n.prototype.resetFilter=function(){this._filter=null;this.invalidated.invoke()},n.prototype.getFilterKey=function(){var r="",t=this._filter,i,n;if(t&&t.value&&t.distribution)for(i=t.value,n=0;nthis._maxFailureForFailover||s,y=this._getUpdatedUrlWithCredentials(e,v),p=function(n){c._handleResponse(r,e,u,f,o,n,!0)},w=function(i,h){t.log(null,"ERROR: failed to get {0}",l);h===4||s?c._handleResponse(r,e,u,f,o,n._createEmptyResponse(),!1,h):(c._requestFailedCount++,c._logNetworkError(),c._downloadGrid(r,u,f,e,o,!0))};this._requests[u]=h.downloadJsonp(y,"grid",p,w,a,!1,null,0)},n.prototype._handleResponse=function(r,u,f,e,o,s,h,c){var p=this,v,l,a,y;this._map.isDisposed()||(v=r.quadKey,delete this._requests[f],t.groupCollapsed(null,"Callback for lod: {0} quadkey {1}",r.lod.toString(),v),t.timeEnd(i._formatString("Network call for quadkey - {0}",v)),t.time(i._formatString("Parsing vector response for quadkey - {0}",v)),l=n._responsesCacheV2.getItem(u),l||(s&&!s.tag?l=this._parseResponse(s,r,u):(l=n._responsesCacheV2.getItem(u)||{},tt.mergeProperties(l,this._parseNullDataRegion(e))),h&&n._responsesCacheV2.addItem(u,l)),t.timeEnd(i._formatString("Parsing vector response for quadkey - {0}",v)),s&&s.requestFailed||(a=this._getVectorDataResponse(e,l)),a||(a={primitives:null,requestFailed:!0,requestAborted:c===4}),y=a&&a.primitives,y&&y.length>0?this._map.getTemplateSelector().then(function(n){var t=function(){for(var t,h,i,r=[],u=[],e=[],s=0;s0&&u.push({bucketId:t.bucket,indexes:h}));i=[];r.length>0&&i.push(n.prefetchImages(r));u.length>0&&i.push(n.prefetchShields(u));e.length>0&&i.push(n.prefetchOrganizationImagesByOrgId(e));Promise.all(i).then(function(){p._completeRequest(o,p._filterResponse(a),f)})};n.selectorReady().then(t)}):this._completeRequest(o,this._filterResponse(a),f),t.groupEnd())},n.prototype._completeRequest=function(n,t){n(t)},n.prototype._getDispatchKey=function(n,t,i,r){var u=n.quadKey;return t?u+"_"+t+"_"+i+"_"+r:u+"_"+i+"_"+r},n._createEmptyResponse=function(){return{entities:[],layers:{},requestFailed:!0}},n.prototype._getVectorDataResponse=function(n,t){var u=null,i,r;if(n)this._layersOfInterest.indexOf(n)>-1&&(u=t[n]);else{for(i=[],r=0;r0&&(u={primitives:i})}return u},n.prototype._parseNullDataRegion=function(t){var u,i,r;if(n._nullDataRegionResponse||(u={isNullDataRegionMarker:!0,crs:ni.instance,geometryType:1,geometry:{x:0,y:0,bounds:[90,180,-90,-180]}},n._nullDataRegionResponse={primitives:[u]}),i={},t)i[t]=n._nullDataRegionResponse;else for(r=0;r0)for(g={},nt=Object.keys(a),w=0,ft=nt.length;w0&&(i.x.push(i.x[0]),i.y.push(i.y[0])),r=0;rt||h<0||h>t?(l=!0,r>0&&(e=[],u=this._lineIntersect(0,0,0,t,i.x[r-1],i.y[r-1],i.x[r],i.y[r]),u&&e.push(u),u=this._lineIntersect(0,0,t,0,i.x[r-1],i.y[r-1],i.x[r],i.y[r]),u&&e.push(u),u=this._lineIntersect(0,t,t,t,i.x[r-1],i.y[r-1],i.x[r],i.y[r]),u&&e.push(u),u=this._lineIntersect(t,0,t,t,i.x[r-1],i.y[r-1],i.x[r],i.y[r]),u&&e.push(u),e.length===1&&f?(f.x.push(e[0].x),f.y.push(e[0].y)):e.length===2&&o.push({x:[e[0].x,e[1].x],y:[e[0].y,e[1].y],bounds:null,b:[0,0,t,t]})),f&&(o.push(f),f=null)):(f||(f={x:[],y:[],bounds:null,b:[0,0,t,t]}),l&&(u=this._lineIntersect(0,0,0,t,i.x[r-1],i.y[r-1],i.x[r],i.y[r])||this._lineIntersect(0,0,t,0,i.x[r-1],i.y[r-1],i.x[r],i.y[r])||this._lineIntersect(0,t,t,t,i.x[r-1],i.y[r-1],i.x[r],i.y[r])||this._lineIntersect(t,0,t,t,i.x[r-1],i.y[r-1],i.x[r],i.y[r]),u&&(f.x.push(u.x),f.y.push(u.y))),f.x.push(s),f.y.push(h),l=!1);f&&o.push(f)}return o},n.prototype._lineIntersect=function(n,t,i,r,u,f,e,o){var h,s,c,l,a;return n===i&&t===r||u===e&&f===o?null:(h=(o-f)*(i-n)-(e-u)*(r-t),h===0)?null:(s=((e-u)*(t-f)-(o-f)*(n-u))/h,c=((i-n)*(t-f)-(r-t)*(n-u))/h,s<0||s>1||c<0||c>1)?null:(l=n+s*(i-n),a=t+s*(r-t),new ui(l,a))},n.prototype._getUpdatedUrlWithCredentials=function(n,t){return t?this._urlContainsCredentialsParam||(n+="&key="+ii.instance.getSessionId()):!t&&this._urlContainsCredentialsParam&&(n=n.replace(/&?key={credentials}/ig,"")),n},n.prototype._logNetworkError=function(){var n,t;this._requestFailedCount===this._maxFailureForFailover+1&&Math.random()<=.1&&(n=u.logger,n&&(t={feature:"MC",action:"ERR",data:{errorMessage:"Basemap vector data requests failed "+this._requestFailedCount+" times. Switching over to use TFE authentication."}},n.logCriticalError(null,t)))},n._responsesCacheV2=new a(50),n}(),function(n){function t(n,t){var i=t[n]||{};return i.type==="SvgFixedColor"?i.color:i.type==="SvgPaletteColor"?{value:i.color,property:e(i.svgPaletteColor)}:null}function w(n){var t=null;return n&16?t="semiBold":n&1?t="bold":n&32&&(t="light"),t}function h(n){for(var i,r=[],t=0,u=n;t0)t=this._fixedStringList[u];else{e=i;break}return e},n.prototype.getColorPaletteValue=function(n,t){var r=NaN,i;return n=n||0,i=this._items[n],i&&(t&&i.keyId!==n||(r=i.value)),r},n.prototype.getSinglePaletteValue=function(n,t,i){var u,r;return i===void 0&&(i=1),u=i,n=n||0,r=this._items[n],r&&(t&&r.keyId!==n||(u=r.value)),u},n.prototype.getBooleanPaletteValue=function(n){var i=!1,t;return n=n||0,t=this._items[n],t&&(i=t.value),i},n.prototype.getStringPaletteValue=function(n){var i="",t;return n=n||0,t=this._items[n],t&&(i=this._fixedStringList[t.stringId]),i},n.prototype.getFixedStringId=function(n){var t=this._fixedStringMap[n];return typeof t!="number"&&(t=-1),t},n.prototype.getFixedString=function(n){return this._fixedStringList[n]},n.prototype.populate=function(i,r,u){var h,s,e,o,a,y,f;if(!i.isParsed){if(i.isParsed=!0,h={},i.nodeType){for(s=i.nodeType.properties,e={name:i.nodeType.name,parent:i.nodeType.parent,properties:i.nodeType.properties};e.parent&&e.parent.properties;)s=s.concat(e.parent.properties),e=e.parent;for(f=0;f=0?(y=o.additionalAttributes?n._clone(o,o.keyId):o,this._addItem(y,a),h[c]=y):t.assert(!0,"KeyId not in FixedStrings "+a)):t.assert(!0,"Palette key should be present "+v))}}if(i.children)for(f=0;f1?t[1].replace(/^["\s]+|["\s]+$/g,""):""}function l(n){var r=n.split(","),u="",f="";return t.assertNotNull(r,"shield attributes"),t.assert(r.length===4,"all four shield attributes should be present"),r&&r.length===4&&(u=i(r[0]),f=i(r[3])),{text:u,modifier:f}}function a(n,t){var r=n,i=r&&(r.ypid||r.businesslistingid);return t&&i&&i.indexOf(":")>-1&&(i=i.split(":")[1]),i}function v(n){var t=n;return t&&t.tj}function y(n){var t=n;return t&&t.representsTransitStop}function p(n){return n&&n.poiType===5}n.getClickable=r;n.getDisplayName=u;n.getSecondaryDisplayName=f;n.independentHotRegions=e;n.getIconText=o;n.getLabelImportance=s;n.getShieldNames=h;n.getShieldIndices=c;n.getShieldDisplayData=l;n.getYpid=a;n.getTransitJson=v;n.isTransitEntity=y;n.isLandmarkEntity=p})(w||(w={}));l=function(){function n(r,u,e,o,s,h,c,l){var v;this._clientPerf=l;this._customStyleManager=u;this._imageLoader=o;this._styleEntryBucketMap=e;u&&(u.styleEntryBucketMap=e);this._primitiveTemplateCache=new a(100);this._categoryIconCache=new a(100);this._templateName=h;v=h===null||h===void 0?void 0:h.toUpperCase();this._isVibrant=v==="7DCFF932-3B97-4B3E-9EB4-5B9AA89EFA3C"||v==="33B050CC-BA4E-4350-A5B7-4171AEC234A2";this._state=[];this._stlVersion=c;this._bucketToMappedImageIndex={};this._bucketToPassDefinitionIndex={};this._bucketToDrawOrderListIndex={};this._mappedToUnmappedImageIndex={};this._unmappedToMappedImageIndex={};this._unmappedIndexToBucketIds={};this._images={};this.ready=new y;t.enableFunctionalTestHooks&&i._getUrlParam(window.location,"teststylefailure")==="1"&&(n._retryTimeout=1);var p=f.dynamicProperties,w=p.compositionHandlerGenerationId,b=r.mapTemplateUrlBase.replace("{stlRequestDomain}",p.bingRequestDomain);r.catMapUrlFormat&&(this._catMapUrlFormat=i._updateTfeUrlDomain(r.catMapUrlFormat.replace("{urlbase}",b)).replace("{stlVersion}",this._stlVersion).replace("{ctpVersion}",f.ctpVersion.toString()).replace("{odmgenid}",w).replace("{subdomain}","0"));this._urlFormat=i._updateTfeUrlDomain(s.replace("{urlbase}",b)).replace("{stlVersion}",this._stlVersion).replace("{odmgenid}",w);tt.mergeProperties(n._localCatIdBucketMapping,n._localCatIdBucketMapping_Delta);this._markupOrder=new a(1e3);this._shieldImages={};this._shieldScaleListForZoom={};this._initialized=!1;this._retryCount=0}return n.init=function(){var i={},t={},r={};["50","64","65","226","227","228","229","230","231","232","233","234","235","236","237","238","239","240","241","242","243","244","245","246","247","248","249","250","251","252","253","254","1392","1899"].forEach(function(n){i[n]=!0;t[n]=!0});["337","338","339","340","341","342","350","351","352","1386","1387","353","1370","1371","344","1441","1442","1443","1966"].forEach(function(n){t[n]=!0});["254","253","252","251","250","249","243","242","241","236","235","232","231","230","229","228","227","226"].forEach(function(n){r[n]=!0});n._transitBucketIds=i;n._invertedIconBucketIds=t;n._multimodeTransitBucketIds=r},n.prototype.getName=function(){return this._templateName},n.isDarkTheme=function(n){return!!this._darkTemplates[n]},n.extractCategoryId=function(t,i){var u,r;for(t=t||"",u=t.split("."),r=u.length-1;r>=0;r--)if(n.getBucketForCategory(u[r]))return u[r];return i?n.DefaultBucketForLocalCat:null},n.getBucketForCategory=function(t){var i,r=n._categoryBucketMap,u;return r?(u=r[t]||r[n._categoryRemap[t]]||n._categoryFallbackMap[t],i=u&&u.bucketId.toString()):i=n._localCatIdBucketMapping[t],i},n.getPaletteKeyForCategory=function(t){var i="",r=n._bucketPaletteMap,u=n.getBucketForCategory(t);return r&&(i=r[u]||""),i},n.prototype.selectorReady=function(){var n=this;return this._ready||(this._ready=new Promise(function(t,i){var r=[n._initCategoryMap(),n._initTemplateData()];n._styleEntryBucketMap&&parseFloat(n._stlVersion)>=8.12&&r.push(n._styleEntryBucketMap.ready());Promise.all(r).then(function(){n._initialized=!0;n._ready=new it(n);t(n)},function(){n._ready=null;i(null)})})),this._ready},n.prototype._initCategoryMap=function(){var i=this,t=n._catMapPromise;return t||(t=this._catMapUrlFormat?new Promise(function(n){h.downloadJson(i._catMapUrlFormat,"catmap",function(t){i._onCatMapResponse(t);n(null)},function(){n(null)},null,!1,null,!1)}):new it(null),n._catMapPromise=t),t},n.prototype._onCatMapResponse=function(t){var r,o,i;if(!this._isDisposed&&t){var u=t.categoryMap||[],f={},e={};for(r=0,o=u.length;r-1?i=0:(t||t===0)&&typeof t=="number"&&(i=3)),i},n.prototype._parseTemplate=function(i,u){var s=this,rt,st,ut,p,c,ht,ct,lt,at,h,w,ft,l,et,b,vt,k,a,yt,pt,e,d,f,wt,y,ot,nt,tt,bt;if(t.time("ParseTemplate"),rt=this._graphPassDefinitionList=i.graphs,this._landColor=i.landColor,this._drawOrderList=i.drawOrder,this._shieldStyleResponseData={},i&&i.shields)for(e=0,st=i.shields.length;e=0&&(this._bucketToMappedImageIndex[y]=nt),tt=this._mappedToUnmappedImageIndex[nt],this._unmappedIndexToBucketIds[tt]||(this._unmappedIndexToBucketIds[tt]=[]),this._unmappedIndexToBucketIds[tt].push(y);t.timeEnd("ParseTemplate");bt=[n._haloImageBucket,n.DefaultBucketForLocalCat,o.widePricePoiBucket&&this._isVibrant?n.widePricePoiBucketId:n.pricePoiBucketId,n.xsrPolygonBucketId,n.cityPolygonBucket,n.itineraryPoiBucketId,n._multimodeTransitBucket];this.prefetchImages(bt,pt,!0).then(function(){s._initialized=!0;s._ready=new it(s);u();s.ready&&s.ready.invoke()})},n.prototype._populateSplineGraphValueAndPaletteKey=function(n,t){var e,u,i,f,r;switch(t){case 1:for(u=0;u=0&&(tt=f[b],tt?f[i].parent=tt:v[i]=b),it=y.properties,d=0;d=0))){s[i]={name:k,nodeType:rt};h.parentId>=0&&(w=s[h.parentId],w?(w.children||(w.children=[]),w.children.push(s[i])):p[i]=h.parentId);for(u in p)i===p[u]&&(e=s[u],e&&(e.children||(e.children=[]),e.children.push(s[i]),delete p[u]))}for(c={},i=0;i0)break;if(h.length===0)return null;for(l=0,w=h.length;l=16&&t<=19?(o.offsetX=15,o.offsetY=15):(o.offsetX=17,o.offsetY=17);break;case n.bucketIdForSelectedPoi:o.offsetX=24;o.offsetY=24;p=this._getColor("SelectedPointState"+n._labelColor,!0)}a=s.style;f=a.styleDynamic;a.styleStatic=o;f.font=e.font;f.fontPaletteKey=e.fontPaletteKey;f.fontColor=p;f.fontColorPaletteKey=e.fontColorPaletteKey;f.fontSize=e.fontSize;f.secondaryFontSize=e.secondaryFontSize;f.fontWeight=e.fontWeight;f.fontWeightPaletteKey=e.fontWeightPaletteKey;f.fontStyle=e.fontStyle;f.fontStylePaletteKey=e.fontStylePaletteKey;f.fontCaps=e.fontCaps;f.fontCapsPaletteKey=e.fontCapsPaletteKey;f.outlineColor=e.outlineColor;f.outlineColorPaletteKey=e.outlineColorPaletteKey;s.visibility=y}}return s},n.prototype._getMarkupOrderTemplate=function(t,i,r){var u=this._passDefinitionList[t],l={styleStatic:{},styleDynamic:{font:"",fontSize:0,fontColor:"",outlineColor:""},markupPassDefinitionIndex:t},f=l.styleStatic,e=l.styleDynamic,a,w,o,s,h,v,y,c,p;e.font=this._computeSplineGraphObject(u.fontName,i)||"SegoeBing";e.fontPaletteKey=this._getSplineGraphPaletteKey(u.fontName);a=this._computeSplineGraphObject(u.fontColorTransform,i);e.fontColor=a?this._computeHslaTransform(u.fontColor,i,a,r):this._computeSplineGraphObject(u.fontColor,i);e.fontColorPaletteKey=this._getSplineGraphPaletteKey(u.fontColor);e.fontWeight=this._computeSplineGraphObject(u.fontWeight,i)||0;e.fontWeightPaletteKey=this._getSplineGraphPaletteKey(u.fontWeight);e.fontStyle=this._computeSplineGraphObject(u.fontStyle,i)||0;e.fontStylePaletteKey=this._getSplineGraphPaletteKey(u.fontStyle);e.fontCaps=this._computeSplineGraphObject(u.fontCapitals,i)||0;e.fontCapsPaletteKey=this._getSplineGraphPaletteKey(u.fontCapitals);f.preferredFontSize=this._computeSplineGraphObject(u.preferedFontSize,i);f.preferredFontSizePaletteKey=this._getSplineGraphPaletteKey(u.preferedFontSize);f.fontSizeTransform=this._computeSplineGraphObject(u.preferedFontSizeTransform,i)||1;e.fontSize=f.preferredFontSize*f.fontSizeTransform;f.pointLabelPlacementPreference=this._computeSplineGraphObject(u.pointPlacement,i);f.polygonFillPreference=this._computeSplineGraphObject(u.areaFillingPreference,i);f.verticalAlignment=this._computeSplineGraphObject(u.lineVerticalAlign,i);f.fontGlow=this._computeSplineGraphObject(u.fontGlow,i);f.fontOutlined=this._computeSplineGraphObject(u.fontOutlined,i);f.fontUnderlined=this._computeSplineGraphObject(u.fontUnderlined,i);f.glowColor=this._computeSplineGraphObject(u.glowColor,i);f.glowSize=this._computeSplineGraphObject(u.glowSize,i);w=this._computeSplineGraphObject(u.heightMatch,i);switch(w){case"LabelHeightMatchXHeight":o=2;break;case"LabelHeightMatchAscent":o=1;break;default:o=0}return o!==0&&(s=0,h=this._computeSplineGraphObject(u.heightMatchPixels,i),h&&(v=this._computeSplineGraphObject(u.heightMatchPixelsTransform,i),v&&(h*=v),o===1?s=h*n._capHeightRatio:o===2&&(s=h*n._xHeightRatio),s0&&(f=f*e)),f},n.prototype._setStateIndex=function(){var t="en-us",n,i;for(this._currentStateIndex=0,n=0;n1&&(r=c[0]))}return r},n.prototype._getPoiVectorImageTemplate_PoiRefresh=function(n,t,i,r,u,f){var e,o,s=f,h,c,l;if(s||(h=this._bucketToDrawOrderListIndex[n],c=h&&this._getStyleVisibility(h),s=c&&this._isTemplateVisible(r,c,1)),s){if(l=this._getScaleFromZoom(r,n,null,t),o="".concat(n,",").concat(t.join("."),",").concat(l,",").concat(u),e=this._primitiveTemplateCache.getItem(o),e)return e;e=this._getTemplates_PoiRefresh(i,u,n,null,1,r,t,f,!0,l);e&&this._primitiveTemplateCache.addItem(o,e)}return e},n.prototype._getTemplates_PoiRefresh=function(i,u,f,e,s,h,c,l,a,v){var b=null,ut,ft,g,nt,p,y,tt,et,it,ct,w,rt,ot,lt,st;if(!this._initialized)return t.log(null,"TemplateSelector needs to be initialized before getTemplates() call"),null;ut=n._trafficIncidentIdBucketMapping[f];ft=ut!==undefined;ft&&(f="344");var k=this._passDefinitionList[this._bucketToPassDefinitionIndex[f]],d=this._getStyleScale(h),ht=e&&this._getOrgImage(e);if(ft)g=this._getStyleVisibility(this._bucketToDrawOrderListIndex[f]),(l||this._isTemplateVisible(h,g,s))&&(p=this._getImage(ut),nt=v===null?this._getScale(k.scale,k.scaleTransform,d):v,b=[new r(p,nt)]);else if(e&&ht)g=this._getStyleVisibility(this._bucketToDrawOrderListIndex[f]),(l||this._isTemplateVisible(h,g,s))&&(nt=v===null?this._getScale(k.scale,k.scaleTransform,d):v,b=[new r(ht,nt)]);else if(p=this._getImageByBucketId(f),y=p?p.template:null,y&&a&&(tt=JSON.parse(JSON.stringify(y.getVectorImage())),y=new r(tt)),y&&(l||this._isTemplateVisible(h,p.visibility,s))){for(i===2?y=this._applyStackedShape(2,u,c,y,0):u&&!y.hasPlaceholderText&&(y=this._applyStackedShape(3,u,c,y,0)),y=this._applyStackedShape(null,u,c,y,0),o.enableTrafficRefresh&&(y=this._applyStackedShape(i,u,c,y,1)),tt=y.getVectorImage(),et=tt.records,it=0,ct=et.length;it=0&&n.push(t);i&&n.push.apply(n,i.split(";"))},n._setLineDashes=function(n,t,i){var r,f,o,h;if(n&&typeof n=="number"&&isFinite(n)&&typeof t=="number"&&t>0&&t<=32){r=[];n=Math.floor(n);f=void 0;n<0&&(n=n>>>0);f=n.toString(2).slice(-t);var e=0,u=0,s="";for(o=f.length-1;o>=0;o--)h=f[o],h!==s&&(u&&(r.length||s!=="0"?r.push(u):e=u),s=h,u=0),u++;f.lengthl.lineWidth&&(c.secondaryLineWidth=c.lineWidth,c.secondaryStrokeStyle=c.strokeStyle,y=!0):y=!0))),y?tt.mergeProperties(c,l):(c=l,d.push(l)));v=d.map(function(n){return new bt(n)});this._primitiveTemplateCache.addItem(it,v)}return v},n.prototype.getCityPolygonTemplates=function(t,i,r,u,f){var e=null;return(t===n.cityPolygonBucket||t===n.xsrPolygonBucketId)&&(e=this.getPolygonTemplates(3,n.xsrPolygonBucketId,r,1,u,f)),e},n.getPushpinTextTemplates=function(t,i,u,f){var h=[],e={style:{fillStyle:"rgb(255,255,255)",font:"Arial, Helvetica, Sans-Serif",fontStyle:1,fontSize:11.25,horizontalAutoScaling:1},text:"{MapDisplay}",anchor:{x:0,y:0},vectorType:3,scale:1},o,l,s,a;if(i){var v=i.height,c=i.width,y={pointsList:[{x:0,y:0},{x:c,y:0},{x:c,y:v},{x:0,y:v}],vectorType:0,style:{fillStyle:"rgba(255,255,255,0)"},scale:1};e.maxWidth=c;e.style.fontSize=10;e.anchor.x=u.x;e.anchor.y=u.y;o={records:[y,e],hitTest:1};h=[new r(o,1,f)]}else l=t.getVectorImage().records,s=l[l.length-1],s&&s.vectorType===2&&(a=n._cloneObject(s),e.maxWidth=a.radiusX*2/1.414,o={records:[a,e],hitTest:1},h=[new r(o,t.getScale())]);return h},n.prototype.getTemplates=function(i,u,f){var l,s,c,y,o,a,p,w;if(f===void 0&&(f=!1),l=null,!this._initialized)return t.log(null,"TemplateSelector needs to be initialized before getTemplates() call",this._initialized),null;var k=i.bucket,v=b.fromScale(null,u,!0),h=this._getImageByBucketId(k),e=h?h.template:null;if(e&&f&&(s=JSON.parse(JSON.stringify(e.getVectorImage())),e=new r(s)),e&&this._isTemplateVisible(v,h.visibility,i.geometryType)){for(s=e.getVectorImage(),c=0,y=s.records.length;c-1||o.indexOf(n._borderColor)>-1||o.indexOf(n._colorString)||o.indexOf(n._fillColor))&&(s.records[c].style.fillStyle=a);p=this._getStyleScale(v);w=this._getScale(h.scale,h.scaleTransform,p);e.setScale(w);l=[e]}return l},n.prototype._getVisibilitiesByIndex=function(n,t,i,r){var e={drawingStyleVisibilities:{}},k,w,s,h,f,o,u,nt,b,y,l;e.geometryType=this._getGeometryType(i[n]);k=t[n];for(w in k){s=[];e.densityLodCollection=new g;switch(w){case"point":h=1;break;case"line":h=2;break;case"polygon":h=3}if(h===e.geometryType){var a=p.markupVisible,v=1,c=0,tt=t[n][w],d=r[tt];for(f=0;f=0;f--){if(u=s[f],c=this._getStyleScale(u.zoom),nt=u.densityDistance===0&&u.densityImportance===0,nt)e.densityLodCollection.addRange(c,v,a);else{for(b=(v-c)/p.zoomDeltaBetweenLods,y=a+b,l=c;l=e.zoom&&(o=e.visible,k=e.densityDistance,d=e.densityImportance,g=e.densityLodDelta);if(t===3){for(a=!1,c=n.visibility.drawingStyleVisibilities[2],s=0;s=e.zoom&&(a=e.visible);(o||a)&&(o=!0)}h&&(v=this._getCustomStyle(h),v!==undefined?o=v:o&&(y=this._getStackedBooleanValue(r,this._fixedStringList[h]),y!==undefined&&(o=y)))}return o&&(f={visible:o,densityDistance:k,densityImportance:d,densityLodDelta:g,priority:n.priority,font:u.font,fontPaletteKey:u.fontPaletteKey,fontSize:u.fontSize,fontWeight:u.fontWeight,fontWeightPaletteKey:u.fontWeightPaletteKey,fontStyle:u.fontStyle,fontStylePaletteKey:u.fontStylePaletteKey,fontCaps:u.fontCaps,fontCapsPaletteKey:u.fontCapsPaletteKey,fontColor:u.fontColor,fontColorPaletteKey:u.fontColorPaletteKey,outlineColor:u.outlineColor,outlineColorPaletteKey:u.outlineColorPaletteKey,secondaryFontSize:u.secondaryFontSize||u.fontSize,globalOrder:n.globalOrder},this._applyStackedString(r,f,"font","fontPaletteKey"),p=this._getStackedNumericValueItem(r,b.preferredFontSizePaletteKey),l=p&&p.value,typeof l=="number"&&isFinite(l)&&(f.fontSize=l*b.fontSizeTransform),this._applyStackedEnum(r,f,"fontWeight",f.fontWeightPaletteKey),this._applyStackedEnum(r,f,"fontStyle",f.fontStylePaletteKey),this._applyStackedEnum(r,f,"fontCaps",f.fontCapsPaletteKey),this._applyStackedColor(r,f,"fontColor",f.fontColorPaletteKey),this._applyStackedColor(r,f,"outlineColor",f.outlineColorPaletteKey)),f},n.prototype._getCustomStyle=function(n){var i=this._fixedStringList[n],t=i&&i.split("."),r;return t&&t.length===2&&(r=this._customStyleManager.getElementStyle(t[0],t[1])),r},n.prototype._getStyleScale=function(n){return Math.round(p.calculateStyleScaleForLod(n)*1e7)/1e7},n.prototype.prefetchShields=function(n,t){var i=this;return t===void 0&&(t=3),new Promise(function(r){for(var a,h,e,u,v,y,o,c,p,l=[],s={},f=0;f=0&&(i._getImage(u)?i._updateCachedImages(u):s[u]||(s[u]=!0));for(v=Object.keys(s),y=function(r){l.push(new Promise(function(u){i._imageLoader.prefetchImages(r,i._svgColor,i._palette,function(n){i._isDisposed||i._updateCachedImages(n[0]);u()},function(){t>0&&Microsoft.Maps.setTimeout(function(){i._isDisposed||i.prefetchShields(n,--t)},200);u()})}))},o=0,c=v;o0&&Microsoft.Maps.setTimeout(function(){i._isDisposed||i.prefetchOrganizationImagesByOrgId([n],t-1)},200);r()})}))},r=0,e=u;r=0&&(t=u._mappedToUnmappedImageIndex[n],u._getImage(t)&&u._updateCachedImages(t),r=u._mapImages[n],c=c||!r,(!r||i)&&(s[t]=!0))},e=0,o=n.length;e0&&Microsoft.Maps.setTimeout(function(){u._isDisposed||u.prefetchImages(n,t,i,--r)},200);f()})}))},e=0,o=l.length;e=0&&(r=o[u],r&&f&&f[u]&&r.setScale(f[u]),r||(r=d.DefaultShieldTemplate)),s.push(r);return s},n.prototype.getShieldsAsync=function(n,t,i,r){var u=this,f;r&&(f={bucketId:t,indexes:i},this.selectorReady().then(function(){u.prefetchShields([f]).then(function(){r(u.getFetchedShields(n,t,i))})}))},n.prototype.dispose=function(){this._shieldStyleResponseData=null;this._computedSplineGraphs=[];this._markupOrder&&this._markupOrder.clear();this._serverBooleanValues=[];this._serverColorValues=[];this._serverEnumValues=[];this._serverSingleValues=[];this._serverStringValues=[];this._graphPassDefinitionList=[];this._styleVisibilities=[];this._passDefinitionList=[];this._markupVisibilities=[];this._images=null;this._imgVariants=[];this._markupOrderList=null;this._palette=null;this._drawOrderList=null;this._mapImages=[];this._svgColor=[];this._imageGroups=[];this._groupedImageOptions=[];this._fixedStringList=[];this._shieldImages=null;this._shieldScaleListForZoom=null;this._state=[];this._urlFormat=null;this._propertyValues=[];this._primitiveTemplateCache.clear();this._categoryIconCache.clear();this._bucketToMappedImageIndex={};this._bucketToPassDefinitionIndex={};this._bucketToDrawOrderListIndex={};this._mappedToUnmappedImageIndex={};this._unmappedToMappedImageIndex={};this._unmappedIndexToBucketIds={};this._visibilityRanges=null;this.ready&&this.ready.dispose();window.clearTimeout(this._delayLoadTimerId);this._isDisposed=!0},n.prototype._isTemplateVisible=function(n,t,i){for(var o,u=t.drawingStyleVisibilities[i],s=u.length||0,f=!1,e,r=0;r=u[r].zoom&&(f=u[r].visible);return this._customStyleManager&&this._customStyleManager.hasCustomStyle&&(o=this._getCustomStyle(e),typeof o=="boolean"&&(f=o)),f},n.prototype._getScaleFromZoom=function(n,t,i,r){var f,s=this._getStyleScale(n),e,u,h,o;return i&&this._getOrgImage(i)?(e=this._passDefinitionList[this._bucketToPassDefinitionIndex[t]],f=this._getScale(e.scale,e.scaleTransform,s)):(u=this._getImageByBucketId(t),u?(h=this._getSplineGraphPaletteKey(u.scale),o=this._getStackedNumericValueItem(r,h)||{},f=this._getScale(u.scale,u.scaleTransform,s,o.value,o.ignoreTransform)):f=null),f},n._cloneObject=function(n){var i,r,t,f,u;if(!n||typeof n!="object")return n;for(i={},r=Object.keys(n),t=0,f=r.length;t0?n.lod-1:0);this._west=n.x/t*360-180;this._east=(n.x+1)/t*360-180;this._north=90-n.y/i*180;this._south=90-(n.y+1)/i*180;this._x1=e.instance.projectToX(this._north,this._west);this._width=(e.instance.projectToX(this._south,this._east)-this._x1)/this._maxValue;this._y1=e.instance.projectToY(this._north,this._west);this._height=(e.instance.projectToY(this._south,this._east)-this._y1)/this._maxValue;this._mercatorToGridCrsMatrix=null}return n.prototype.getMatrix=function(n){var i=n.id,t=this._matrixCache.getItem(i);return t||(t=this._getMatrixInternal(n),this._matrixCache.addItem(i,t)),t},n.prototype._getMatrixInternal=function(n){var i=new ti(this._width,0,0,this._height,this._x1,this._y1),t;return n===e.instance?i:(t=n.getMatrix&&n.getMatrix(e.instance),t)?t.invert().multiply(i):null},n.prototype._getMercatorToGridCrsMatrix=function(){return this._mercatorToGridCrsMatrix||(this._mercatorToGridCrsMatrix=this._getMatrixInternal(e.instance).invert()),this._mercatorToGridCrsMatrix},n.prototype.projectToX=function(n,t){return this._project(n,t,!0)},n.prototype.projectToY=function(n,t){return this._project(n,t,!1)},n.prototype._project=function(n,t,i){var r=e.instance.projectToX(n,t),u=e.instance.projectToY(n,t),f=this._getMercatorToGridCrsMatrix();switch(i){case!0:return f.projectX(r,u);case!1:return f.projectY(r,u)}},n.prototype.toLatitude=function(n,t){var i=this._x1+this._width*n,r=this._y1+this._height*t;return e.instance.toLatitude(i,r)},n.prototype.toLongitude=function(n,t){var i=this._x1+this._width*n,r=this._y1+this._height*t;return e.instance.toLongitude(i,r)},n}(),ci=function(){function n(n){var r=0,u=0,t,i;if(n===0)t=0;else{for(var e=n,o=2147483648,f=31;f&&!(e&o);)f--,o/=2;t=(f+1)/2}for(i=0;i>(t-i-1)*2&1,i>0&&(u<<=1,u|=n>>(t-i-1)*2+1&1);for(var e=n&2147483647>>32-2*t,s="0",h=t;h--;)s+="0123".charAt(e>>h*2&3);this.quadKey=s;this.x=r;this.y=u;this.lod=t;this.crs=new at(this);this.bounds=[0,16384,16384,0]}return n.fromLocation=function(t,i){if(i===0)return new n(1);if(i===1)return new n(t.longitude>0?3:2);var r=2<>u-e-1&1,f<<=1,f|=i>>u-e-1&1;f|=1<=0&&(u=u.replace(t.YpidPreffix,""));l&&i.has3DLandmark&&(s={id:a,ypid:u,collisionBehavior:1,name:i.name,changed:new y});s&&(c=t._createPushpin(e,s,this._layer),h.primitives.push(c))}return h},t._createPushpin=function(n,r,u){var e=n.geometry,s=n.crs,c=new ri(s.toLatitude(e.x,e.y),s.toLongitude(e.x,e.y)),l=i._getImageFromCss("bm_3dLandmarkIconNormal"),h=f.features.landmarks3D,a={width:t.IconSize,height:t.IconSize},v=t.IconSize+h.iconOffsetDefault[0],y=t.IconSize+h.iconOffsetDefault[1],o=new ei(c,r,l,new wt(v,y),a);return o.isHoverEnabled=function(){return!0},o.layer=u,o},t.IconSize=35,t.YpidPreffix="ypid:",t}(vt),yt=function(){function n(n,t,i){var r=this;this._layerId=n;this._parentDataSource=t;this.spatialIndex=i;this.invalidated=new y;t.invalidated.add(function(n){return r.invalidated.invoke(n)})}return n.prototype.getParentDataSource=function(){return this._parentDataSource},n.prototype.getPrimitives=function(n,t,i,r){this._parentDataSource.getPrimitivesInternal(n,this._layerId,t,i,r)},n.prototype.applyFilter=function(n){this._parentDataSource.applyFilter(n)},n.prototype.resetFilter=function(){this._parentDataSource.resetFilter()},n.prototype.cancelPrimitivesRequest=function(n,t){this._parentDataSource.cancelPrimitivesRequestInternal(n,this._layerId,t)},n.prototype.getDataUniquenessKey=function(n){t.assertNotNull(n,"regionId");return n.quadKey+this._parentDataSource.getFilterKey()},n}(),c;(function(n){var t=function(){function n(n){this._coreConfig=n}return n.prototype.ready=function(){var n=this;return this._readyPromise||(this._readyPromise=new Promise(function(t,r){var u=f.dynamicProperties,e=n._coreConfig.mapTemplateUrlBase.replace("{stlRequestDomain}",u.bingRequestDomain),s=i._updateTfeUrlDomain(o.styleEntryToBucketUrl.replace("{urlbase}",e)).replace("{stlVersion}",f.stlVersion).replace("{odmgenid}",u.compositionHandlerGenerationId).replace("{subdomain}","0");h.downloadJson(s,"basemapdata",function(i){n._entryToBucket={};Object.keys(i).forEach(function(t){n._entryToBucket[t.toLowerCase()]=i[t]});t()},function(){r()},null,!1,null,!1)})),this._readyPromise},n.prototype.getEntryBucket=function(n,t){var i=n&&this._entryToBucket&&this._entryToBucket[n.toLowerCase()],r;if(i)switch(t){case 3:r=i.a;break;case 2:r=i.l;break;case 1:r=i.p}return r},n}();n.StyleEntryBucketMap=t})(c||(c={}));n.BadgeTemplateSelector=ut;n._BaseMapDataSource=k;n._BaseMapStreetsideDataSource=oi;n._EntityHelper=w;n.BaseMapImageLoader=c.BaseMapImageLoader;n._BaseMapTemplateSelector=l;n._BaseMapTemplateSelectorProxy=hi;n._GridId=ci;n._GridCrs=at;n._LandmarksDataSource=vt;n._LayerDataSource=yt;n._Landmarks3DDataSource=li;n.StyleEntryBucketMap=c.StyleEntryBucketMap}catch(pt){if(u.logger)u.logger.logCriticalError(pt);else throw pt;}}).call(window)